﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using Newtonsoft.Json;
using System.Windows.Media;
using System.Collections.ObjectModel;
namespace BallData
{
    class OddsUntil
    {
        public static int GETINDAY = 5;
        public static String HOST = "主队";
        public static String VISIT = "客队";
        public static Hashtable dx_europeoddsfields = new Hashtable { { "d_hostwinodds", "主胜" }, { "d_pingodds", "和" }, { "d_visitodds", "客胜" }, { "d_hostwinpercent", "主胜率" }, { "d_pingpercent", "和率" }, { "d_visitpercent", "客胜率" }, { "d_getbackpercent", "返还率" }, { "d_hostwin_nowodds", "即时主胜" }, { "d_ping_nowodds", "即时和" }, { "d_visit_nowodds", "即时客胜" }, { "d_hostwin_nowpercent", "即时主胜率" }, { "d_ping_nowpercent", "即时和率" }, { "d_visit_nowpercent", "即时客胜率" }, { "d_getback_nowpercent", "即时返还率" } };
        //public static List<String> europeoddsfields = new List<String> { "主胜", "和", "客胜"};
        //public static List<String> europeoddsfields2 = new List<String> { "主胜率","和率", "客胜率","返还率"};
        
        public static List<Hashtable> europeoddsfieldsmap = new List<Hashtable> { 
        new Hashtable { {"初始赔率", new List<String> { "主胜", "和", "客胜" } }}, 
        new Hashtable { {"初始概率", new List<String> { "主胜率", "和率", "客胜率", "返还率" }}}, 
        new Hashtable { {"即时赔率",new List<String> { "主胜", "和", "客胜" }}},
        new Hashtable { {"即时概率", new List<String> { "主胜率", "和率", "客胜率", "返还率" }}}
 
        };

        public static List<Hashtable> team_state = new List<Hashtable> { 
            new Hashtable{ {"statename","偏低"},{"statearea",new List<double>{0,30}},{"winpercent",10}},
            new Hashtable{ {"statename","中低"},{"statearea",new List<double>{30,40}},{"winpercent",20}},
            new Hashtable{ {"statename","中等"},{"statearea",new List<double>{40,50}},{"winpercent",30}},
            new Hashtable{ {"statename","中高"},{"statearea",new List<double>{50,60}},{"winpercent",40}},
            new Hashtable{ {"statename","很高"},{"statearea",new List<double>{60,100}},{"winpercent",50}}
        };
        public static List<String> team_statefield = new List<String> { "主胜概率", "和概率", "客胜概率" }; 
        public static Hashtable updowncount = new Hashtable { { "hostupcount", "主胜上升" }, { "hostdowncount", "主胜下降" } ,{"pingupcount","和上升"}, {"pingdowncount","和下降"},{"visitupcount","客胜上升"},{"visitdowncount","客胜下降"},{"hostwinpercentupcount","主胜率上升"},{"hostwinpercentdowncount","主胜率下降"},{"pingpercentupcount","和率上升"},{"pingpercentdowncount","和率下降"},{"visitpercentupcount","客胜率上升"},{"visitpercentdowncount","客胜率下降"}};
        public static List<String> europeupdownfields = new List<String> {"主胜上升","主胜下降","和上升","和下降","客胜上升","客胜下降","\n","主胜率上升", "主胜率下降","和率上升","和率下降","客胜率上升","客胜率下降" };
        
        public static List<Match_FilterItemBind> FilterList = new List<Match_FilterItemBind>();
        public static List<String> filter_oddstypes = new List<String> { "让球","主队水位","客队水位","主胜","和局","客胜","大球","盘口","小球"};
        public static List<String> filter_leaguetypes = new List<String> { "得分","排名","胜率"};
        public static List<String> filter_history_vss = new List<String> { "胜", "平", "负" };
        public static List<String> filter_close_vss = new List<String> { "连胜", "连平","连负","连赢盘","连走盘","连输盘","连续大球","连续小球",};

        public static String[] GoalCn = {"平手", "平手/半球", "半球", "半球/一球", "一球", "一球/球半", "球半", "球半/两球", "两球", "两球/两球半", "两球半", "两球半/三球", "三球", "三球/三球半", "三球半", "三球半/四球", "四球", "四球/四球半", "四球半", "四球半/五球", "五球", "五球/五球半", "五球半", "五球半/六球", "六球", "六球/六球半", "六球半", "六球半/七球", "七球", "七球/七球半", "七球半", "七球半/八球", "八球", "八球/八球半", "八球半", "八球半/九球", "九球", "九球/九球半", "九球半", "九球半/十球", "十球", "十球/十球半", "十球半", "十球半/十一球", "十一球", "十一球/十一球半", "十一球半", "十一球半/十二球", "十二球", "十二球/十二球半", "十二球半", "十二球半/十三球", "十三球", "十三球/十三球半", "十三球半", "十三球半/十四球", "十四球"};
        public static String[] GoalOU = {"0", "0/0.5", "0.5", "0.5/1", "1", "1/1.5", "1.5", "1.5/2", "2", "2/2.5", "2.5", "2.5/3", "3", "3/3.5", "3.5", "3.5/4", "4", "4/4.5", "4.5", "4.5/5", "5", "5/5.5", "5.5", "5.5/6", "6", "6/6.5", "6.5", "6.5/7", "7", "7/7.5", "7.5", "7.5/8", "8", "8/8.5", "8.5", "8.5/9", "9", "9/9.5", "9.5", "9.5/10", "10", "10/10.5", "10.5", "10.5/11", "11", "11/11.5", "11.5", "11.5/12", "12", "12/12.5", "12.5", "12.5/13", "13", "13/13.5", "13.5", "13.5/14", "14"};
        public static String[] GoalOU2 = {"0", "0/-0.5", "-0.5", "-0.5/-1", "-1", "-1/-1.5", "-1.5", "-1.5/-2", "-2", "-2/-2.5", "-2.5", "-2.5/-3", "-3", "-3/-3.5", "-3.5", "-3.5/-4", "-4", "-4/-4.5", "-4.5", "-4.5/-5", "-5", "-5/-5.5", "-5.5", "-5.5/-6", "-6", "-6/-6.5", "-6.5", "-6.5/-7", "-7", "-7/-7.5", "-7.5", "-7.5/-8", "-8", "-8/-8.5", "-8.5", "-8.5/-9", "-9", "-9/-9.5", "-9.5", "-9.5/-10", "-10"};

        public static String[] result={"负","平","胜"};
        public static String[] panlu={"","输","走","赢"};
        public static String[] overUnder={"小","走","大"};

        public static String[] oddstype = { "a", "e", "o" };

        public static String WinLoseCaiPiaoName = "胜负彩票";
        public static String BeiJingCaiPiaoName = "北单彩票";
        public static String OtherMatchName = "其他";
        public static String Filter_MatchName = "比赛过滤";
        public static String Goal2GoalCn(String goal) 
        {
            if (goal == "")
                return "";
            else 
            {
                if (Convert.ToDouble(goal) >= 0)
                    return OddsUntil.GoalCn[Convert.ToInt32(Convert.ToDouble(goal) * 4)];
                else
                    return "受让" + OddsUntil.GoalCn[Math.Abs(Convert.ToInt32(Convert.ToDouble(goal) * 4))];
            }
        }
        public static String GetPercentVs(double odds)
        {
            foreach (Hashtable hash in team_state)
            {
                List<double> list = hash["statearea"] as List<double>;
                if (list[0] < odds && odds < list[1])
                    return hash["statename"] as String;
            }
            return "";
        }
        public static int GetPercentWinPercent(String statename)
        {
            foreach (Hashtable hash in team_state)
            {
               if (hash["statename"] == statename)
               {
                   return (int)hash["winpercent"];
               }
            }
            return 0;
        }
        public static String Goal2GoalOU(String goal) 
        {
            if (goal == "")
                return "";
            else 
            {
                if (Convert.ToInt32(goal) >= 0)
                    return OddsUntil.GoalOU[Convert.ToInt32(goal) * 4];
                else
                    return OddsUntil.GoalOU2[Math.Abs(Convert.ToInt32(goal) * 4)];
            }
        }

        public static Int32 InitNetdataCount = 3;
        public static Int32 ShowOtherLeagueMatchCount = 8;
        public static String White = "#FFFFFF";
        public static int MaxMatchCount = 6;
        public static String host_a = "#00FFFF";
        public static String visit_a = "#7FFFD4";

        public static String host_e = "#FFD700";
        public static String visit_e = "#DAA520";

        public static String host_o = "#90EE90";
        public static String visit_o = "#FFB6C1";

        public static String companyLight = "#00FFFF";
        public static Brush tabdefaultdefault = null;
        // 存储赛事显示信息模版
        public static Hashtable MathViewTemple = new Hashtable();//matchid_cid=>MatchListDataTemple

        // 存储联盟信息显示模版
        public static Hashtable LeagueViewTemple = new Hashtable();//league_id=>List<MatchListDataTemple>

        public static bool IsInMatchListDataTemple(ObservableCollection<MatchListDataTemple> list,MatchListDataTemple mt)
        {
            foreach (MatchListDataTemple m in list)
            {
                if (m.mId == mt.mId)
                {
                    return true;
                }
            }
            return false;
        }

        public static String GetMathViewKey(String mId,String cId)
        {
            return mId + "_" + cId;
        }
        public static String GetRandStr(int getlen)
        {
            
            String strtable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

            Random r1 = new Random();
            StringBuilder stret = new StringBuilder();
            for (int i = 0; i < getlen;i++ )
            {
                stret.Append(strtable[r1.Next(strtable.Length)]);
            }

            return stret.ToString();
        }

        public static String GetCompanyType(String id,String name)
        {
            for (int i = 0; i < OddsUntil.commonCompany.Length; i++)
            {
                if (Convert.ToInt32(id) == OddsUntil.commonCompany[i]) 
                    return "*";
            }

            if (name == null || name.Length == 0) 
                return "|";
            StringBuilder ret = new StringBuilder();
            Char c = name[0];
            if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
                ret.Append(Char.ToUpper(c));
            else if (c >= '0' && c <= '9')
                ret.Append("0");
            else
                ret.Append("@");
            return ret.ToString();
        }

        public static int getCCSort(int id)
        {
            for(int i = 0; i< OddsUntil.commonCompany.Length; i++) 
            {
                if(id == OddsUntil.commonCompany[i])
                    return i;
            }
            return id + 10000;
        }

        public static Int32[] commonCompany = {1,127,4,1001,1006, 1015,5,7,19};
        public static Int32[] defaultCompany = { 1, 4, 5, 7, 24, 19, 199, 228 };
        public static Int32[] MainCompanyInWorld = { 1, 4, 5, 7, 24, 19, 199, 228, 1001 };
        public static Char SplitDomain = '$';
        public static Char SplitColumn = '^';
        public static Char SplitRecord = '~';
        public static Char SplitArray = ',';

        public static Char Bet007_SplitDomain = '$';
        public static Char Bet007_SplitRecord = ';';
        public static Char Bet007_SplitColumn = ',';

        public static System.DateTime ConvertIntDateTime(double d)
        {
            System.DateTime time = System.DateTime.MinValue;
            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
            time = startTime.AddSeconds(d);
            return time;
        }

        /// <summary>
        /// 将c# DateTime时间格式转换为Unix时间戳格式
        /// </summary>
        /// <param name="time">时间</param>
        /// <returns>double</returns>
        public static double ConvertDateTimeInt(System.DateTime time)
        {
            double intResult = 0;
            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
            intResult = (time - startTime).TotalSeconds;
            return intResult;
        }

        public static String GetVsTypeName(int index,String typ)
        {
            if (typ == "en" || typ == "2")
            {
                return OddsUntil.VsType[index].vstype2;
            }
            else
            {
                return OddsUntil.VsType[index].vstype1;
            }
            
        }
        public static String GetVsName(String vsId,String typ) 
        {

            String str = "";

            String vid = vsId;

            if (vid != null && vid != "" && (Convert.ToInt32(vid) != 0 || vid.Substring(0, 1) == "-" || vid == "0")) 
              {

                int tt = 1;

                if(vid.Length > 0 && vid.Substring(0,1) == "-") 
                {
                  tt = 0;
                  vid = Convert.ToString(Math.Abs(Convert.ToInt32(vid)));
                }

                str = OddsUntil.GetVsTypeName(tt, typ);

                if(Convert.ToInt32(vid) >= 0 && Convert.ToInt32(vid) < OddsUntil.oddsVslist.Count) 
                {

                    if (typ == "en" || typ == "2")
                    {
                        str += OddsUntil.oddsVslist[Convert.ToInt32(vid)].vs2;
                    } 
                    else
                    {
                        str += OddsUntil.oddsVslist[Convert.ToInt32(vid)].vs1;
                    }
                    
                }
            return str;
        }



        return str;

        }
        public static String GetTotalName(String vs)
        {
            String ret = "";
            if (vs != null && vs != "" && Convert.ToInt32(vs) > 0)
            {
                ret = OddsUntil.oddsVslist[Convert.ToInt32(vs)].vs2;
            }
            return ret;
        }
        public static String getPeriod(String period, Boolean ll) 
        {
            if (period == "0")
                return "参考盘";
            else if(period=="2")
                return "初盘";
            else if(ll)
                return "当前赔率";
            else
                return "";
        }
        public static List<OddsVsData> oddsVslist = new List<OddsVsData>();
        //public static List<OddsVsData> oddsVslist = new List<OddsVsData>(new OddsVsData[]{
        //    new OddsVsData{vs1="平手",vs2="0"},
        //    new OddsVsData{vs1="平手/半球",vs2="0/0.5"},
        //    new OddsVsData{vs1="半球",vs2="0.5"},
        //    new OddsVsData{vs1="半球/一球",vs2="0.5/1"},
        //    new OddsVsData{vs1="一球",vs2="1"},
        //    new OddsVsData{vs1="一球/球半",vs2="1/1.5"},
        //    new OddsVsData{vs1="球半",vs2="1.5"},
        //    new OddsVsData{vs1="球半/两球",vs2="1.5/2"},
        //    //new OddsVsData{vs1="两球",vs2="2"},
        //    //new OddsVsData{vs1="两球/两球半",vs2="2/2.5"},
        //    //new OddsVsData{vs1="两球半",vs2="2.5"},
        //    //new OddsVsData{vs1="两球半/三球",vs2="2.5/3"},
        //    //new OddsVsData{vs1="三球",vs2="3"},
        //    //new OddsVsData{vs1="三球/三球半",vs2="3/3.5"},
        //    //new OddsVsData{vs1="三球半",vs2="3.5"},
        //    //new OddsVsData{vs1="三球半/四球",vs2="3.5/4"},
        //    //new OddsVsData{vs1="四球",vs2="4"},
        //    //new OddsVsData{vs1="四球/四球半",vs2="4/4.5"},
        //    //new OddsVsData{vs1="四球半",vs2="4.5"},
        //    //new OddsVsData{vs1="四球半/五球",vs2="4.5/5"},
        //    //new OddsVsData{vs1="五球",vs2="5"},
        //    //new OddsVsData{vs1="五球/五球半",vs2="5/5.5"},

        //});


        public static List<OddsVsType> VsType = new List<OddsVsType>
        {   new OddsVsType{vstype1="",vstype2="-"},
            new OddsVsType{vstype1="受让",vstype2="+"}
        };

        public static void initVsList()
        {
            
            OddsUntil.oddsVslist.Insert(0,new OddsVsData{vs1="平手",vs2="0"});
            OddsUntil.oddsVslist.Insert(1,new OddsVsData{vs1="平手/半球",vs2="0/0.5"});
            OddsUntil.oddsVslist.Insert(2,new OddsVsData{vs1="半球",vs2="0.5"});
            OddsUntil.oddsVslist.Insert(3,new OddsVsData{vs1="半球/一球",vs2="0.5/1"});
            OddsUntil.oddsVslist.Insert(4,new OddsVsData{vs1="一球",vs2="1"});
            OddsUntil.oddsVslist.Insert(5,new OddsVsData{vs1="一球/球半",vs2="1/1.5"});
            OddsUntil.oddsVslist.Insert(6,new OddsVsData{vs1="球半",vs2="1.5"});
            OddsUntil.oddsVslist.Insert(7, new OddsVsData { vs1 = "球半/两球", vs2 = "1.5/2" });

            String[] ddc = {"两","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十"};
            for(int ii=0; ii<ddc.Length - 1; ii++) 
            {
                String vsdata1 = ddc[ii] + "球";
                String vsdata2 = Convert.ToString(ii + 2) + " ";

                OddsUntil.oddsVslist.Insert(ii*4 + 8,new OddsVsData{vs1=vsdata1, vs2=vsdata2});

                vsdata1 = ddc[ii] + "球/" + ddc[ii] + "球半";
                vsdata2 = Convert.ToString( ii + 2) + "/" + Convert.ToString( ii + 2) + ".5";
                OddsUntil.oddsVslist.Insert(ii*4 + 9,new OddsVsData{vs1=vsdata1,vs2 = vsdata2});

                vsdata1 = ddc[ii] + "球半";
                vsdata2 = Convert.ToString(ii + 2) +".5";
                OddsUntil.oddsVslist.Insert(ii*4 + 10,new OddsVsData{vs1 = vsdata1,vs2 = vsdata2});

                vsdata1 = ddc[ii] + "球半/" + ddc[ii + 1] + "球";
                vsdata2 = Convert.ToString( ii + 2 ) + ".5/" + Convert.ToString( ii + 3);
                OddsUntil.oddsVslist.Insert(ii*4 + 11,new OddsVsData{vs1=vsdata1,vs2=vsdata2});
            }
        }

        public static Hashtable companyList = new Hashtable();
        public static void initCompany()
        {
            companyList[1] = "1^*^澳门^澳门^澳门^^";
            companyList[199] = "199^*^12bet^12bet^12bet^^";
            companyList[19] = "19^*^bet365^bet365^bet365^^";
            companyList[4] = "4^*^立博^立博^立博^^";
            companyList[1001] = "1001^*^皇冠^皇冠^皇冠^^";
            //companyList[1015] = "1015^*^新三星^新三星^新三星^^";
            //companyList[1006] = "1006^*^云鼎^雲鼎^云鼎^^";
            //companyList[6] = "6^*^博天堂^博天堂^博天堂^^";
            //companyList[126] = "126^*^10Bet^10Bet^10Bet^^";
            //companyList[201] = "201^*^乐天堂^乐天堂^Asiabet^^";
            companyList[7] = "7^*^威廉^威廉^威廉^^";
            //companyList[172] = "172^*^Canbet^Canbet^Canbet^^";
            //companyList[29] = "29^*^BetInternet^BetInternet^BetInternet^^";
            //companyList[24] = "24^*^BWin^BWin^BWin^^";
            companyList[127] = "127^*^188Bet^188Bet^188Bet^^";
            //companyList[110] = "110^*^wbexonline^wbexonline^wbexonline^^";
            companyList[5] = "5^*^钱德勒-伟德(VC-MAN)^钱德勒-伟德(VC-MAN)^钱德勒-伟德(VC-MAN)^^";
        }
        public static List<MatchLevelData> matchLevel = new List<MatchLevelData>
        {
            new MatchLevelData{matchLeveldata1="第三轮",matchLeveldata2="第三輪",matchLeveldata3="3rd round"},
            new MatchLevelData{matchLeveldata1="普通联赛",matchLeveldata2="普通聯賽",matchLeveldata3="League match"},
            new MatchLevelData{matchLeveldata1="无级别赛事",matchLeveldata2="無級別賽事",matchLeveldata3=""},
            new MatchLevelData{matchLeveldata1="预选赛",matchLeveldata2="預選賽",matchLeveldata3="Qualifying Round"},
            new MatchLevelData{matchLeveldata1="小组赛",matchLeveldata2="小組賽",matchLeveldata3="Group phase"},
            new MatchLevelData{matchLeveldata1="第一阶段小组赛",matchLeveldata2="第一階段小組賽",matchLeveldata3="First Qualfying Round"},
            new MatchLevelData{matchLeveldata1="第二阶段小组赛",matchLeveldata2="第二階段小組賽",matchLeveldata3="Second Qualfying Round"},
            new MatchLevelData{matchLeveldata1="第二轮",matchLeveldata2="第二輪",matchLeveldata3="2nd round"},
            new MatchLevelData{matchLeveldata1="六十四强",matchLeveldata2="六十四強",matchLeveldata3="32nd-final"},
            new MatchLevelData{matchLeveldata1="三十二强",matchLeveldata2="三十二強",matchLeveldata3="16th-final"},
            new MatchLevelData{matchLeveldata1="十六强",matchLeveldata2="十六強",matchLeveldata3="8th-final"},
            new MatchLevelData{matchLeveldata1="八强",matchLeveldata2="八強",matchLeveldata3="Quater-final"},
            new MatchLevelData{matchLeveldata1="半决赛",matchLeveldata2="半決賽",matchLeveldata3="Semifinal"},
            new MatchLevelData{matchLeveldata1="三、四名决赛",matchLeveldata2="三四名決賽",matchLeveldata3="3rd Place Match"},
            new MatchLevelData{matchLeveldata1="决赛",matchLeveldata2="決賽",matchLeveldata3="Final"},
            new MatchLevelData{matchLeveldata1="资格赛",matchLeveldata2="資格賽",matchLeveldata3="Qualfying Match"},
            new MatchLevelData{matchLeveldata1="资格赛第一轮",matchLeveldata2="資格賽第一輪",matchLeveldata3="Qualfying Round1"},
            new MatchLevelData{matchLeveldata1="资格赛第二轮",matchLeveldata2="資格賽第二輪",matchLeveldata3="Qualfying Round2"},
            new MatchLevelData{matchLeveldata1="资格赛第三轮",matchLeveldata2="資格賽第三輪",matchLeveldata3="Qualfying Round3"},
            new MatchLevelData{matchLeveldata1="资格赛半决赛",matchLeveldata2="資格賽半決賽",matchLeveldata3="Qualfying Semifinal"},
            new MatchLevelData{matchLeveldata1="资格赛决赛",matchLeveldata2="資格賽決賽",matchLeveldata3="Qualfying Final"},
            new MatchLevelData{matchLeveldata1="第一轮",matchLeveldata2="第一輪",matchLeveldata3="1st round"},
            new MatchLevelData{matchLeveldata1="升级附加赛",matchLeveldata2="升級附加賽",matchLeveldata3="Promotion Playoffs"},
            new MatchLevelData{matchLeveldata1="保级附加赛",matchLeveldata2="保級附加賽",matchLeveldata3="Regelation Playoffs"},
            new MatchLevelData{matchLeveldata1="单循环赛",matchLeveldata2="單循環賽",matchLeveldata3="Single Round Robin"},
            new MatchLevelData{matchLeveldata1="双循环赛",matchLeveldata2="雙循環賽",matchLeveldata3="Double Round Robin"},
            new MatchLevelData{matchLeveldata1="常规赛",matchLeveldata2="常規賽",matchLeveldata3="Regular"},
            new MatchLevelData{matchLeveldata1="季后赛",matchLeveldata2="季後賽",matchLeveldata3="Playoff"},
            new MatchLevelData{matchLeveldata1="季前赛",matchLeveldata2="季前賽",matchLeveldata3="Preseason"},
            new MatchLevelData{matchLeveldata1="东部决赛",matchLeveldata2="東部決賽",matchLeveldata3="Eastern-Final"},
            new MatchLevelData{matchLeveldata1="西部决赛",matchLeveldata2="西部決賽",matchLeveldata3="Western-Final"},
            new MatchLevelData{matchLeveldata1="总决赛",matchLeveldata2="總決賽",matchLeveldata3="Final"},
            new MatchLevelData{matchLeveldata1="其它",matchLeveldata2="其它",matchLeveldata3="Others"},
            new MatchLevelData{matchLeveldata1="附加赛",matchLeveldata2="附加賽",matchLeveldata3="Play-off"},
            new MatchLevelData{matchLeveldata1="五、六名决赛",matchLeveldata2="五六名決賽",matchLeveldata3="5th Match"},
            new MatchLevelData{matchLeveldata1="东部半决赛",matchLeveldata2="東部半決賽",matchLeveldata3="Eastern-Semifinal"},
            new MatchLevelData{matchLeveldata1="西部半决赛",matchLeveldata2="西部半決賽",matchLeveldata3="Western-Semifinal"},
            new MatchLevelData{matchLeveldata1="第四轮",matchLeveldata2="第四輪",matchLeveldata3="4th Round"},
            new MatchLevelData{matchLeveldata1="第五轮",matchLeveldata2="第五輪",matchLeveldata3="5th Round"},
            new MatchLevelData{matchLeveldata1="第六轮",matchLeveldata2="第六輪",matchLeveldata3="6th Round"},


        };

        public static List<MatchStatus> matchStatus = new List<MatchStatus>
        {
            new MatchStatus{matchstatusdata1="",matchstatusdata2="",matchstatusdata3=""},
            new MatchStatus{matchstatusdata1="未",matchstatusdata2="未",matchstatusdata3=""},
            new MatchStatus{matchstatusdata1="待",matchstatusdata2="待",matchstatusdata3="FT ONLY"},
            new MatchStatus{matchstatusdata1="上",matchstatusdata2="上",matchstatusdata3="1st"},
            new MatchStatus{matchstatusdata1="下",matchstatusdata2="下",matchstatusdata3="2nd"},
            new MatchStatus{matchstatusdata1="半",matchstatusdata2="半",matchstatusdata3="HT"},
            new MatchStatus{matchstatusdata1="完",matchstatusdata2="完",matchstatusdata3="FT"},
            new MatchStatus{matchstatusdata1="加",matchstatusdata2="加",matchstatusdata3="Extra"},
            new MatchStatus{matchstatusdata1="加上",matchstatusdata2="加上",matchstatusdata3=""},
            new MatchStatus{matchstatusdata1="加下",matchstatusdata2="加下",matchstatusdata3=""},
            new MatchStatus{matchstatusdata1="加完",matchstatusdata2="加完",matchstatusdata3=""},
            new MatchStatus{matchstatusdata1="点球",matchstatusdata2="點球",matchstatusdata3="Penalty"},
            new MatchStatus{matchstatusdata1="停",matchstatusdata2="停",matchstatusdata3="Pause"},
            new MatchStatus{matchstatusdata1="斩",matchstatusdata2="斬",matchstatusdata3="Suspend"},
            new MatchStatus{matchstatusdata1="取消",matchstatusdata2="取消",matchstatusdata3="Cancel"},
            new MatchStatus{matchstatusdata1="改期",matchstatusdata2="改期",matchstatusdata3="Postp"},
            new MatchStatus{matchstatusdata1="延时",matchstatusdata2="延時",matchstatusdata3=""},
        };

        
        public static Hashtable getEuropeRate(double win,double draw,double lose) 
        {

            Hashtable ret = new Hashtable();
            if(win == 0 || draw == 0 || lose == 0) 
            {
                ret["retRate"] = "--";
                ret["winRate"] = "--";
                ret["drawRate"] = "--";
                ret["loseRate"] = "--";
            } 
            else 
            {
                double r_ret = 1 / ( 1/win + 1/draw + 1/lose);
                double r_win = r_ret/win;
                double r_draw = r_ret/draw;
                double r_lose = r_ret/lose;

                ret["retRate"] = String.Format("{0:00.00}",Math.Round(r_ret*1000)/10) + "%";
                ret["winRate"] = String.Format("{0:00.00}", Math.Round(r_win * 1000) / 10) + "%";
                ret["drawRate"] = String.Format("{0:00.00}", Math.Round(r_draw * 1000) / 10) + "%";
                ret["loseRate"] = String.Format("{0:00.00}", Math.Round(r_lose * 1000) / 10) + "%";
            }

          return ret;
        }

        #region
        public static List<ColorOdds> companyoddscolor = new List<ColorOdds> 
        { 
            new ColorOdds{host=Colors.Red,visit=Colors.Green},
            new ColorOdds{host=Colors.Red,visit=Colors.Green},
            new ColorOdds{host=Colors.Blue,visit=Colors.OliveDrab},
            new ColorOdds{host=Colors.BlueViolet,visit=Colors.Orchid},
            new ColorOdds{host=Colors.DeepPink,visit=Colors.PaleVioletRed},
            new ColorOdds{host=Colors.Indigo,visit=Colors.Violet},
            new ColorOdds{host=Colors.Maroon,visit=Colors.MediumSpringGreen},
        };
        #endregion

        public static List<String> defaultLeague = new List<String> { "英超", "西甲", "德甲", "意甲", "法甲", "欧洲杯", "欧冠杯","冠军杯"};

        #region
        public static String  GetLevelName(String levelId,String lang)
        {
                String str = "";
                int l = (lang == "en" ? 2 : (lang=="tr"?1:0));

                int ilevelId = Convert.ToInt32(levelId);
                if (ilevelId > 0 && ilevelId < OddsUntil.matchLevel.Count)
                {
                    if(l == 0)
                        str = OddsUntil.matchLevel[ilevelId].matchLeveldata1;
                    else if(l == 1)
                        str = OddsUntil.matchLevel[ilevelId].matchLeveldata2;
                    else
                        str = OddsUntil.matchLevel[ilevelId].matchLeveldata2;
                }
                return str;
        }
        #endregion
        public static String GetRoundName(String roundNum,String lang) 
        {
            String str = "";
            if(lang=="en")
                str = "Round "+roundNum;
            else if(lang=="tr")
                str = "第"+roundNum+"輪";
            else
                str = "第"+roundNum+"轮";
            return str;
        }

        public static String GetStatusName(String statusId,String lang) 
        {
            String str = "";
            int l = (lang=="en"?2:(lang=="tr"?1:0));
            int istatusId = Convert.ToInt32(statusId);

            if (istatusId >= 0 && istatusId < OddsUntil.matchLevel.Count) 
            {
                if(l == 0)
                    str = OddsUntil.matchStatus[istatusId].matchstatusdata1;
                else if(l == 1)
                    str = OddsUntil.matchStatus[istatusId].matchstatusdata2;
                else
                    str = OddsUntil.matchStatus[istatusId].matchstatusdata3;
            }
            return str;
        }

        public static void GetDataBymList(ref OddsInfo odds_asia,ref OddsInfo odds_eupro ,ref OddsInfo odds_bigsmall,ref Hashtable mList)
        {
            if (mList != null)
            {
                foreach (Hashtable hs in mList.Values)
                {
                    foreach (List<OddsInfo> listoddsinfo in hs.Values)
                    {
                        foreach(OddsInfo os in listoddsinfo)
                        {
                            if (os.oType == "a" && odds_asia == null)
                            {
                                odds_asia = os;
                            }
                            if (os.oType == "e" && odds_eupro == null)
                            {
                                odds_eupro = os;
                            }
                            if (os.oType == "o" && odds_bigsmall == null)
                            {
                                odds_bigsmall = os;
                            }
                        }
                        

                    }
                }
            }

            if (odds_asia == null)
            {
                odds_asia = new OddsInfo();
            }
            if (odds_eupro == null)
            {
                odds_eupro = new OddsInfo();
            }
            if (odds_bigsmall == null)
            {
                odds_bigsmall = new OddsInfo();
            }
        }

        public static String[] ww = {"一", "二", "三", "四", "五", "六", "日"};
        public static String getWeekNo(String no) 
        {
            return "周" + ww[Convert.ToInt32(no.Substring(0, 1)) - 1] + no.Substring(1);
        }

        public static List<IAnalysis> analysiss = new List<IAnalysis>();
    }
        
    class OddsVsData
    {

        public String vs1 { get; set; }
        public String vs2 { get; set; }
    }
    class OddsVsType
    {
        public String vstype1{get;set;}
        public String vstype2{get;set;}
    }
    class MatchLevelData
    {
        public String matchLeveldata1;
        public String matchLeveldata2;
        public String matchLeveldata3;

    }
    class MatchStatus
    {
        public String matchstatusdata1;
        public String matchstatusdata2;
        public String matchstatusdata3;
    }

    //线条颜色方案
    class ColorOdds
    {
        public Color host { get; set; }
        public Color visit { get; set; }
    }
    
}
